package com.example.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class Bbb extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_02_second);
        Button b = findViewById(R.id.button_close);
//        b.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                finish();
//            }
//        });

        View.OnClickListener l = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = getIntent();
                i.putExtra("zhou","站长");
                setResult(200,i);
                finish();
            }
        };
        b.setOnClickListener(l);


        // 获取传递过来的数据
        Intent i = getIntent();
        Bundle bundle = i.getExtras();
        String s = bundle.getString("cake");
        TextView t = findViewById(R.id.text_second);
        t.setText(s);


    }
}
